package com.ylkj.member.dao.impl;

import java.util.List;

import org.springframework.stereotype.Repository;

import com.ylkj.common.base.BaseDaoHibernate;
import com.ylkj.common.entity.UpCodelist;
import com.ylkj.member.dao.UpCodeListDAO;

@Repository
public class UpCodeListDAOImpl extends BaseDaoHibernate implements UpCodeListDAO {

	@SuppressWarnings("unchecked")
	@Override
	public List<UpCodelist> getUpCodeList(String parm) {
		StringBuffer sb = new StringBuffer("from UpCodelist a where a.codetype=:codetype");
		
//		if (para.get("contractId") != null && !para.get("contractId").equals("")) {
//			sb.append(" and contractId=:contractId");
//			paras.add("contractId");
//			values.add(para.get("contractId"));
//		}
		return getHibernateTemplate().findByNamedParam(sb.toString(), "codetype", parm);
	}

	@SuppressWarnings("unchecked")
	@Override
	public List<UpCodelist> getUpCodeListByCity(String parm, String parent) {
		StringBuffer sb = new StringBuffer("from UpCodelist a where a.codetype=:codetype and a.parent=:parent");
		return getHibernateTemplate().findByNamedParam(sb.toString(), new String[]{"codetype","parent"}, new Object[]{parm,parent});
	}

}
